package cn.hyatt.auth.entity;

import cn.hyatt.core.entity.BaseEntity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.Email;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Pattern;
import lombok.Getter;
import lombok.NonNull;
import lombok.Setter;

import java.util.List;

/**
 * 部门
 *
 * @author hyatt
 */
@Getter
@Setter
@TableName(value = "system_dept")
@Schema(name = "部门")
public class SystemDept extends BaseEntity {

    @TableField(value = "parent_id")
    @Schema(description = "上级部门")
    private Long parentId;

    @NotNull
    @TableField(value = "name")
    @Schema(description = "部门名称")
    private String name;

    @NotNull
    @TableField(value = "sort")
    @Schema(description = "排序")
    private Integer sort;


    @TableField(value = "ancestors")
    @Schema(description = "祖先列表")
    private String ancestors;


    @TableField(value = "leader")
    @Schema(description = "部门负责人")
    private String leader;


    @Pattern(regexp = "^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\\d{8}$")
    @TableField(value = "phone")
    @Schema(description = "联系电话")
    private String phone;


    @Email
    @TableField(value = "email")
    @Schema(description = "邮箱")
    private String email;

    @NotNull
    @TableField(value = "enabled")
    @Schema(description = "是否启用：true启用 false未启用")
    private Boolean enabled;


    @TableField(exist = false)
    @Schema(description = "子部门")
    private List<SystemDept> subDept;

}
